<!DOCTYPE html>
<html>
<head>
    <include file="Include:meta"/>
    <title>添加运营周报-目的地运营集团数据管理平台</title>
    <include file="Include:style"/>
    <link rel="stylesheet" href="__PUBLIC__/mobile/css/mobiscroll.min.css">
</head>
<body style="background: #f3f3f3;">
<div class="header">
    <a class="back_btn" href="javascript:history.back(-1);"></a>
    添加运营周报
</div>
<include file="Include:commu_menu"/>
<div class="content">
    <div class="communicate_add" style="padding-bottom:64px;">
        <form action="__APP__/Mobile/CrmProjects/weekly_add" method="post">
            <input type="hidden" name="pid" value="{$result['pid']}">
            <input type="hidden" name="project_id" value="{$result['project_id']}">
            <div class="form_item">
                <ul class="choice_list">
                    <li class="tz_li select_li">
                        <select name="year" class="xiala" autocomplete="off">
                            <foreach name="year_list" item="vo">
                                <option value="{$vo}"
                                <if condition="$vo eq $year">selected</if>
                                >{$vo}年</option>
                            </foreach>
                        </select>
                    </li>
                    <input type="hidden" value="" name="year_week">
                    <li class="tz_li select_li">
                        <select name="week" id="week" class="" autocomplete="off">

                        </select>
                    </li>
                </ul>
                <div class="form_item_tit">
                    心情状态*
                </div>
                <div class="form_item_box label_box">
                    <for start="1" end="6">
                        <label class="form_label w60b radio" for="mood{$i}">
                            <input type="radio" name="mood" id="mood{$i}" value="{$i}">
                            {:get_mood($i)}&nbsp;&nbsp;
                        </label>
                    </for>
                </div>
                <div class="form_item_box">
                    <ul class="choice_list">
                        <li class="task_li">
                            <textarea name="tswk" placeholder="本周工作*"></textarea>
                        </li>
                        <li class="task_li">
                            <textarea name="nxwk" placeholder="下周工作*"></textarea>
                        </li>
                        <li class="task_li">
                            <textarea name="description" placeholder="问题描述"></textarea>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="build_btn paddbox">
                <div>
                    <input id="submit" type="submit" value="提交" class="sub_btn">
                </div>
            </div>
        </form>
    </div>
</div>
<include file="Include:javascript"/>
<script src="__PUBLIC__/mobile/js/mobiscroll.min.js"></script>
<script>
    $(function () {
        $('.xiala').mobiscroll().select({
            theme: 'ios',
            lang: 'zh',
            display: 'bottom'
        });

        $('#submit').click(function () {
            var mood = $("input[name='mood']:checked").val()
            var tswk = $("textarea[name='tswk']").val()
            var nxwk = $("textarea[name='nxwk']").val()
            if (mood.length > 0 && tswk.length > 0 && nxwk.length > 0) {
                $('#submit').css({'background': '#8E8E8E'})
                $(this).val("提交中...");
            } else {
                defeated_alert('带*为必填项');
            }
        })
        ajaxWeek();//加载时默认显示当年每周日期
        //年联动周
        $("[name='year']").on("change", function () {
            ajaxWeek();
        });
        $("[name='week']").on("change", function () {
            var week_val = this.value;
            $("[name='year_week']").val($("#week option[value=" + week_val + "]").text());//获取第几周的详情
        });

        //ajax周
        function ajaxWeek() {
            var year = $("[name='year']").val(),
                pid = "{$result['pid']}";
            $.ajax({
                type: "POST",
                asnyc: true,
                dataType: "json",
                data: {"pid": pid, "year": year},
                url: "__APP__/CrmProjects/get_week_all",
                success: function (data) {
                    var option = "<option value=''>请选择</option>";
                    for (var x in data) {
                        option += "<option value=" + data[x].num + ">" + data[x].detail + "</option>";
                    }
                    $("[name='week']").html(option).trigger("change");;
                }
            });
        }
    })
</script>
</body>
</html>